<template>
  <input type="text" v-focus />
  <br>
</template>

<script>
// 当我们需要对dom元素进行底层操作的时候使用自定义指令
export default {
  directives: {
    focus: {
      mounted(el, bindings, vnode, preVnode) {
        console.log('组件挂载1', el)
        console.log('组件挂载2', bindings)
        console.log('组件挂载3', vnode)
        console.log('组件挂载4', preVnode)
        el.focus()
      },
    },
  },
}
</script>

<style scoped></style>
